package com.bonc.ioc.demo.filter;

import com.bonc.ioc.demo.base.wrapper.McpRequestWrapper;
import com.bonc.ioc.demo.utils.AesUtil;
import com.bonc.ioc.demo.utils.Base64Util;
import com.bonc.ioc.demo.utils.HttpParameterUtil;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * @projectName: demo
 * @description: 测试环境解密过滤器，测试环境仅对入参进行解密，出参不做处理，方便测试人员测试
 * @author: Liyy
 * @create: 2020-09-08 10:53
 **/
public class TestDecryptFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        //转换成代理类
        McpRequestWrapper mcpRequestWrapper = HttpParameterUtil.decryptGetParameter((HttpServletRequest) servletRequest);
        //使用复写后的wrapper
        filterChain.doFilter(mcpRequestWrapper, servletResponse);
    }

    @Override
    public void destroy() {

    }

}
